package StringDemo.TraverceString;

import java.util.Scanner;

public class Example1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入一个字符串");
        String st = sc.nextLine();
        int bigCharNum = 0, smallCharNum = 0, charNum = 0;
        for (int i = 0; i < st.length(); i++) {
            if (st.charAt(i) > 'a' && st.charAt(i) < 'z') {
                smallCharNum++;
                charNum++;
            } else if (st.charAt(i) > 'A' && st.charAt(i) < 'Z') {
                bigCharNum++;
                charNum++;
            }
        }
        System.out.println("在你输入的字符串中，有字母" + charNum + "个，大写字母" + bigCharNum + "个，小写字母" + smallCharNum + "个。");
    }
}
